package cn.ee.dfs.wx;

import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * Description:
 * Created by TWJ on 2018/6/19 0019 下午 3:16 .
 */


public class WebConst {

    public static String APP_ID="wx7bb3d751bd6083bd";
    public static String APP_SECRET="567c0b8e5dc17418cec41ab8b57ea90a";

    /**
     * 有效期目前为 2 个小时，需定时刷新 TODO
     */
    public static String ACCESS_TOKEN="";

    /**
     * 一些网站配置
     */
    public static Map<String, String> initConfig = new HashMap<>();

    /**
     * session的key
     */
    public static String LOGIN_SESSION_KEY = "login_user";

    public static final String USER_IN_COOKIE = "S_L_ID";

    public static final String IMG_TYPE_SUFFIX = "JPEG, JPG, PNG, BMP, SVG, GIF";

    /**
     * 文件目录
     */
    public static final String EDITOR_DIR_PREFIX = "/wxIms/editor";


    // 排序规则：降序
    public static final String ORDER_DESC = "desc";
    // 排序规则：升序
    public static final String ORDER_ASC = "asc";

    /**
     * aes加密加盐
     */
    public static String AES_SALT = "0123456789abcdef";
    /**
     *
     */
    public static int MAX_POSTS = 9999;
    public static int MAX_PAGE = 100;

    /**
     * 点击次数超过多少更新到数据库
     */
    public static final int HIT_EXCEED = 10;

    /**
     * 上传文件最大1M
     */
    public static Integer MAX_FILE_SIZE = 1048576;


    /**
     *
     */
    public interface NewsShowType {
        String LIST = "1";
        String PAGE = "2";
    }

    public interface SecretKey {
        String KEY_BASE = "EASTELITE";//twj20190122


        String KEY_DEFAULT = "77643AE57A1A983E92BAE186711AE46D";

        String KEY_USR_INFO = "77643AE57A1A983E92BAE186711AE461";

    }


    /**
     * 可能会放到配置文件中
     */
    public interface ImsApi {
        String usrInfo = "http://47.100.28.23/COOP/AJAX/AJAXMethod.ashx?_type=WeChatUserBinding";
        String menuInfo = "http://47.100.28.23/COOP/AJAX/AJAXMethod.ashx?_type=GetWeChatFunction";
        String noticeInfo = "http://47.100.28.23/COOP/AJAX/AJAXMethod.ashx?_type=GetWeChatNotice";
        String noticeDetail = "http://47.100.28.23/COOP/AJAX/AJAXMethod.ashx?_type=GetWeChatNoticeDetail";
//        String abroadListInfo = "http://47.100.28.23/COOP/StaffAbroadWeChat/GetAbroadListByOpenId.do";
//        String abroadDetail = "http://47.100.28.23/COOP/StaffAbroadWeChat/GetAbroadDetail.do";
        String abroadListInfo = "http://192.168.1.116/IMS/StaffAbroadWeChat/GetAbroadListByOpenId.do";
        String abroadDetail = "http://192.168.1.116/IMS/StaffAbroadWeChat/GetAbroadDetail.do";
        String getSchoolCode = "http://192.168.1.116/IMS/StaffAbroadWeChat/GetSchoolCode.do";
    }


    public interface WxApi {

        String authWebPageBase = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
        String authWebPageUsrInfo = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
        String authWebPageAccessToken = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code";
        String getTokenUrl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";
        String postCreateMenuUrl = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN";
        String sendNotice = "https://api.weixin.qq.com/cgi-bin/msg/template/send?access_token=ACCESS_TOKEN";

    }

}
